﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Entity;
using DAL;

namespace CafeTek
{
    public partial class frmProductType : Form
    {
        public frmProductType()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtName.Equals(""))
                return;
            ProductType productType = new ProductType();
            ProductTypeDB productTypeDB = new ProductTypeDB();
            productType.Name = txtName.Text.Trim();
            productType.Description = txtDes.Text.Trim();
            
            productTypeDB.InsertType(productType);
            MessageBox.Show("Add Successful", "Information", MessageBoxButtons.OK);

            txtName.Clear();
            txtDes.Clear();
            txtName.Focus();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
